<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.hahehiho.myalbum.MyAlbumVO"%>
<%@page import="com.hahehiho.myalbum.MyAlbumDB"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,width=device-width" />
<title>MyAlbum</title>
<link rel="stylesheet" href="css/default.css" >
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>

</head>
<%
request.setCharacterEncoding("UTF-8");

String userAgent = request.getHeader("user-agent");
int tdsize = 1;
if(userAgent.matches(".*BlackBerry.*")) {
} else if(userAgent.matches(".*Android.*")) {
} else if(userAgent.matches(".*iPhone.*")) {
} else if(userAgent.matches(".*iPad.*")) {
	tdsize = 2;
} else {
	tdsize = 4;
}

String pkey = request.getParameter("pkey");

MyAlbumDB db = MyAlbumDB.getInstance();
MyAlbumVO vo = db.selectPhoto(pkey);

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");	
String orgDate  = sdf.format(vo.getOrgDate().getTime());

%>
<body>
<table style="width:100%"><tr><td align="left" width="90%">
<h3><%=vo.getFilePath()%></h3>
</td>
</tr>
</table>
<form id="ff" action="savepic.jsp" method="post">
<input type="hidden" name="pkey" value="<%=pkey%>">
<input type="hidden" name="filepath" value="<%=vo.getFilePath()%>">
<table style="width:95%">
<tr><td width="20%">
<label>Title : </label></td><td><input type="text" style="width:95%"  name="xptitle" value="<%=vo.getXpTitle()%>">
</td></tr>
<tr><td>
<label>Subject : </label></td><td><input type="text" style="width:95%" name="xpsubject" value="<%=vo.getXpSubject()%>">
</td></tr>
<tr><td>
<label>KeyWords : </label></td><td><input type="text" style="width:95%" name="xpkeywords" value="<%=vo.getXpKeywords()%>">
</td></tr>
<tr><td>
<label>Comments : </label></td><td><input type="text" style="width:95%" name="xpcomment" value="<%=vo.getXpComment()%>">
</td></tr>
<tr><td>
<label>OrgDateTime : </label></td><td><input type="datetime-local" name="orgdate" value="<%=orgDate%>" step="1" >
</td></tr>
<tr><td>
<label>GPS : </label></td><td><%=vo.getFullAddr()%>&nbsp;&nbsp;&nbsp;<a href="http://mygeoposition.com/" target="_new">위도, 경도 참조</a>
</td></tr>
<tr><td>
<label>Latitude : </label></td><td><input type="text" name="latitude" value="<%=vo.getLatitude()%>">
</td></tr>
<tr><td>
<label>Longitude : </label></td><td><input type="text" name="longitude" value="<%=vo.getLongitude()%>">
</td></tr>
<tr><td align="center" colspan="2">
<input type="submit" value="SAVE">
</td></tr>
</table>
</form>
<script type="text/javascript">
	$(function(){
		$('#ff').form({
			success:function(data){
				alert(data);
			}
		});
	});
</script>

</body>
</html>